




//
//  hometitlebutton.swift
//  mywei
//
//  Created by myd on 15/12/20.
//  Copyright © 2015年 myd1. All rights reserved.
//

import UIKit

class hometitlebutton: UIButton {
     init(image : String ,and : String, title : String  ) {
        super.init(frame: CGRectZero)
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        self.setImage(UIImage(named:image), forState: UIControlState.Normal)
        self.setImage(UIImage(named:and), forState: UIControlState.Selected)
        self.sizeToFit()
      
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        self.titleLabel?.frame.origin.x = 0
        self.imageView?.frame.origin.x = self.titleLabel!.frame.width
    }

}
